package com.example.forum.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 对拦截器进行配置的操作
 */
@Configuration
public class AppInterceptorConfigure implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;

//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        //配置拦截器的路径
//        registry.addInterceptor(loginInterceptor)
//                .addPathPatterns("/**")
//                .excludePathPatterns("/sign-in.html") // 排除登录HTML
//
//                .excludePathPatterns("/sign-up.html") // 排除注册HTML
//                .excludePathPatterns("/user/login") // 排除登录api接⼝
//                .excludePathPatterns("/user/register") // 排除注册api接⼝
//                .excludePathPatterns("/user/logout") // 排除退出api接⼝
//                .excludePathPatterns("/dist/**") // 排除所有静态⽂件
//                .excludePathPatterns("/image/**")
//                .excludePathPatterns("/**.ico")
//                .excludePathPatterns("/js/**");
//
//
//    }
}
